package com.example.ByteStream;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author Jason
 * @PACKAGE_NAME com.example.ByteStream
 * @Description ObjectInputStream反序列化 读取
 * @date 2023-12-11 21:52
 */
public class ObjectInputStreamDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //1.创建对象流
        FileInputStream fis = new FileInputStream("d:\\aaa.ini");
        ObjectInputStream ois = new ObjectInputStream(fis);
        //2.读取文件（反序列化）
        Student s = (Student) ois.readObject();
        //3.关闭
        ois.close();
        System.out.println("执行完毕");
        System.out.println(s.toString());
    }
}
